package com.fsgom.search.bean;

import java.beans.Encoder;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import org.apache.log4j.Logger;

public class NaverSearchShoppingParam {

	private final Logger log = Logger.getLogger(NaverSearchShoppingParam.class);
	
	String query;
	Integer display;
	Integer start;
	String sort;

	public String getQuery() {
		return query == null ? "" : query;
	}

	public void setQuery(String query) {
		this.query = query;
	}

	public Integer getDisplay() {
		return display == null ? 100 : display;
	}

	public void setDisplay(Integer display) {
		this.display = display;
	}

	public Integer getStart() {
		return start == null ? 1 : start;
	}

	public void setStart(Integer start) {
		this.start = start;
	}

	public String getSort() {
		return sort == null ? "sim" : sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}
	
	public String getParams() throws UnsupportedEncodingException {
		return "?key=51af92d0c715ae6afb642e2964ae79da&target=shop" + "&query=" + URLEncoder.encode(getQuery(), "UTF-8") + "&display=" + getDisplay() + "&start=" + getStart() + "&sort=" + getSort();
	}
}
